package org.goldfish.demo.multifrontend.messageboard.mobile.network

// Removed import for 'Message' if it was specific and not a wildcard
import org.goldfish.demo.multifrontend.messageboard.mobile.model.*
import retrofit2.http.*

interface ApiService {
    @POST("/api/auth/login")
    suspend fun login(@Body req: LoginReq): Map<String, String>

    @POST("/api/auth/register")
    suspend fun register(@Body req: LoginReq): Map<String, String>

    @GET("/api/messages/page")
    suspend fun getAllMessages(
        @Header("Authorization") token: String
    ): List<MessageView>

    @POST("/api/messages")
    suspend fun addMessage(
        @Header("Authorization") token: String, @Body message: AddMessageRequest
    ): AddedMessageResponse

    @DELETE("/api/messages/{id}")
    suspend fun deleteMessage(
        @Header("Authorization") token: String, @Path("id") id: Long
    )

    @GET("/api/messages/user/{userName}")
    suspend fun getMessagesByUser(
        @Header("Authorization") token: String, @Path("userName") userName: String
    ): List<MessageView>

    @GET("/api/messages/stream")
    suspend fun subscribe(
        @Header("Authorization") token: String
    ): SseEmitter

    @GET("/api/messages/page")
    suspend fun getMessagesPage(
        @Header("Authorization") token: String, @Query("page") page: Int, @Query("size") size: Int
    ): List<MessageView>
}